Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delay pass creation until time to run #1621

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Delay pass creation until time to run #1621

wants to merge 1 commit into from

Conversation

shaahji
Copy link
Contributor

@shaahji shaahji commented Feb 14, 2025

Delay pass creation until time to run

Logic avoids instantiating a Pass unless it is to be run. To avoid instantiation, only FullPassConfig is passed around.

Checklist before requesting a review

  • Add unit tests for this change.
  • Make sure all tests can pass.
  • Update documents if necessary.
  • Lint and apply fixes to your code by running lintrunner -a
  • Is this a user-facing change? If yes, give a description of this change to be included in the release notes.
  • Is this PR including examples changes? If yes, please remember to update example documentation in a follow-up PR.

(Optional) Issue link

Logic avoids instantiating a Pass unless it is to be run.
To avoid instantiation, only FullPassConfig is passed around.
@@ -32,6 +33,9 @@
)
from olive.search.utils import cyclic_search_space, order_search_parameters

if TYPE_CHECKING:
from olive.engine.config import RunPassConfig

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'RunPassConfig' may not be defined if module
olive.engine.config
is imported before module
olive.passes.olive_pass
, as the
definition
of RunPassConfig occurs after the cyclic
import
of olive.passes.olive_pass.
@@ -20,6 +20,10 @@
from olive.resource_path import validate_resource_path
from olive.search.search_parameter import SearchParameter, SpecialParamValue, json_to_search_parameter

if TYPE_CHECKING:
from olive.hardware.accelerator import AcceleratorSpec
from olive.passes.olive_pass import Pass

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'Pass' may not be defined if module
olive.passes.olive_pass
is imported before module
olive.passes.pass_config
, as the
definition
of Pass occurs after the cyclic
import
of olive.passes.pass_config.
'Pass' may not be defined if module
olive.passes.olive_pass
is imported before module
olive.passes.pass_config
, as the
definition
of Pass occurs after the cyclic
import
of olive.passes.pass_config.

def create_pass_with_args(self, accelerator: "AcceleratorSpec", host_device: Device) -> "Pass":
"""Create a Pass."""
from olive.package_config import OlivePackageConfig

Check notice

Code scanning / CodeQL

Cyclic import Note

Import of module
olive.package_config
begins an import cycle.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant